package internal

import (
	"encoding/json"
	oneProto "go.opentelemetry.io/collector/pkg/translator/oneapm/proto"
	"google.golang.org/protobuf/proto"
)

var TransDataTest oneProto.TransactionDataRequest
var transDataTestMetricName oneProto.TransactionDataRequest
var transDataTestMetricNameJava oneProto.TransactionDataRequest
var TransDataJava oneProto.TransactionDataRequest
var TransDataBytesPb []byte

var TransDataErrorInfoNilByte = []byte("{\"identifier\":\"golang:Go-Tier-Name:zhangnandeMacBook-Pro-2.local:4318:Go-App-Name\",\"tierName\":\"Go-Tier-Name\"}")

var TransDataErrorTripIdByte = []byte("{\"transactionInfo\":{\"tripId\":\"xx\"}}")

var TransDatasErrorTripIdByte = []byte("{\"transactionInfos\":[{\"tripId\":\"xx\"}]}")

var transDataTestMetricNameByte = []byte("{\"transactionInfo\":{\"traceId\":\"17ba46b2d0a639ed\",\"tripId\":\"17ba46b2d0a639ed\",\"dataContext\":{\"hostAndUrls\":[\"host:11211\"]},\"spans\":[{\"type\":2,\"kind\":7,\"methodName\":\"name\",\"external\":{\"url\":\"https://money.163.com/fund\"}},{\"type\":3,\"kind\":113},{\"type\":1,\"kind\":2,\"methodName\":\"name\",\"mongodbSpanInfo\":{\"operation\":9999}},{\"type\":1,\"kind\":1,\"methodName\":\"name\",\"redisSpanInfo\":{\"hostport\":1,\"redisOperation\":999}},{\"type\":1,\"kind\":3,\"methodName\":\"name\",\"memcachedSpanInfo\":{\"hostport\":999}},{\"type\":1,\"kind\":4,\"methodName\":\"name\",\"xmemcachedSpanInfo\":{\"host\":999}},{\"type\":1,\"kind\":5,\"methodName\":\"name\",\"spymemcachedSpanInfo\":{\"host\":999}},{\"type\":1,\"kind\":6,\"methodName\":\"name\"},{\"type\":1,\"kind\":27,\"methodName\":\"name\"},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"select a from `table`\"}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"select 1 \"}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"drop table a\"}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"select a from table.table\"}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"select a from table.\"}}]}}")

var TransDataJavaByte = []byte("{\"identifier\":\"java:Go-Tier-Name:zhangnandeMacBook-Pro-2.local:4318:Go-App-Name\",\"tierName\":\"Go-Tier-Name\",\"transactionInfo\":{\"responseMsg\":\"error\",\"responseStatus\":400,\"traceId\":\"17ba46b2d0a639ed\",\"tripId\":\"17ba46b2d0a639ed\",\"transactionName\":\"WebTransaction/Go/service.Greeter/SayHello\",\"tierName\":\"Go-Tier-Name\",\"startTimeMs\":1646129617754,\"endTimeMs\":1646129617754,\"startTimeNs\":4373111281014160,\"endTimeNs\":4373113288364966,\"dataContext\":{\"hostAndUrls\":[\"host:xxx/dbname\",\"jdbc:mysql://localhost:3306/testdb\",\"jdbc:sqlserver://localhost:1433/testdb?charst=utf8\"],\"agentAttributes\":[{\"key\":\"rpc.system\",\"value\":\"grpc\"},{\"key\":\"rpc.service\",\"value\":\"service.Greeter\"},{\"key\":\"rpc.method\",\"value\":\"SayHello\"},{\"key\":\"net.peer.ip\",\"value\":\"127.0.0.1\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"}]},\"isWebTransaction\":true,\"requestUrl\":\"127.0.0.1:8004/service.Greeter/SayHello\",\"crossProcessId\":\"9#424\",\"spans\":[{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":1}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"urlFromDataSource\":2}},{\"type\":3,\"kind\":999999},{\"type\":5,\"commonMetricSpanInfo\":{\"className\":\"testClass\",\"methodName\":\"methodName\",\"metricPrefix\":1}},{\"type\":2,\"kind\":7,\"methodName\":\"name\",\"external\":{\"spanRefTraceid\":\"ss\",\"port\":\"xx\",\"url\":\":xx/fund\",\"uri\":\"?a=1\"},\"agentAttributes\":[{\"key\":\"http.url\",\"value\":\"https://money.163.com:xx/fund\"}]},{\"type\":2,\"kind\":7,\"methodName\":\"name\",\"external\":{\"url\":\"https://money.163.com:443\",\"uri\":\"#a=1\"}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"urlFromDataSource\":3}},{\"type\":5,\"commonMetricSpanInfo\":{\"metricName\":\"metricName\",\"metricPrefix\":1}},{\"type\":5,\"methodNameIndex\":2,\"commonMetricSpanInfo\":{\"methodName\":\"f1\",\"metricPrefix\":1}}]},\"settingHashCode\":{\"agent\":1646129593547665000},\"resource\":{\"dataId\":\"Go-App-Name\",\"dataToken\":\"X0haQQpYHlfd44tDCQkVBANUf425AlNcAAxWDA6ee9oGAUlUDQQH57d7UwFeXAQMXgcF\",\"sdkLanguage\":\"java\",\"serviceName\":\"Go-Tier-Name\",\"hostName\":\"zhangnandeMacBook-Pro-2.local\",\"hostIp\":\"10.128.6.99\",\"hostPort\":\"8004\"}}")

var transDataTestMetricNameJavaByte = []byte("{\"identifier\":\"java:Go-Tier-Name:zhangnandeMacBook-Pro-2.local:4318:Go-App-Name\",\"transactionInfo\":{\"traceId\":\"17ba46b2d0a639ed\",\"tripId\":\"17ba46b2d0a639ed\",\"dataContext\":{\"hostAndUrls\":[\"jdbc:sybase:tds:localhost:5007/dbname\",\"jdbc:informix-sqli://127.0.0.1:1533/testDB:INFORMIXSERVER=myserver;user=testuser;password=testpassword\",\"jdbc:sqlserver://localhost:1433;databaseName=master;\",\"host:xxx/dbname?a=111\",\"jdbc:oracle:thin:@localhost:1521:orcl\",\"jdbc:jtds:sqlserver://127.0.0.1:1433;databasename=TestDB\",\"jdbc:postgresql://localhost/dbname\",\"jdbc:db2://127.0.0.1:50000/dbname\",\"jdbc:informix-sqli://123.45.67.89:1533/myDB:INFORMIXSERVER=myserver;user=testuser;password=testpassword\",\"jdbc:dm:/ip:port/database\",\"jdbc:oscar://127.0.0.1:2003/osrdb?usedispatch=true&transactionDispatchStrategy=2\",\"jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(PORT=45372)(HOST=10.128.17.166))(CONNECT_DATA=(SID=vtest)))\",\"jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.128.17.166))(PORT=45372)(CONNECT_DATA=(SID=vtest)))\",\"jdbc:sqlserver://;servername=server_name;integratedSecurity=true;\",\"jdbc:oracle:thin:@::\",\"jdbc:mysql://localhost:3306/test?user=root&password=&useUnicode=true&characterEncoding=gbk&autoReconnect=true&failOverReadOnly=false\",\"//address=(host=master1host)(port=3307)/database\",\"//address=(host=)(port=)/\",\"//address=(port=3307)(host=master1host)/database\",\"//address=(port=)(host=)/database\",\"jdbc:mysql://localhost:/\",\"jdbc:sqlserver://local\\/host:1433;databaseName=master;\",\"jdbc:db2:sample\",\"://xx\",\"xx\",\"jdbc:postgresql:database\",\"jdbc:postgresql://host:5433/\",\"jdbc:informix-direct://testDB;user=rdtest;password=test\",\"jdbc:informix-direct://testDB\",\"jdbc:informix-sqli://3ffe:ffff:ffff:ffff:0::12:8088:informixserver=testDB\",\"jdbc:informix-sqli:informixserver=value;SQLH_TYPE=LDAP;LDAP_URL=ldap://davinci:329;LDAP_IFXBASE=cn=informix,cn=software,o=kmart,c=US;LDAP_USER=abcd;LDAP_PASSWD=secret\",\"jdbc:jtds:sqlserver://127.0.0.1;databasename/\",\"jdbc:jtds:sqlserver://127.0.0.1:34/;databasename=TestDB;servername=localhost\",\"jdbc:informix-sqli://3ffe:ffff:ffff:ffff:0::12::informixserver=\",\"jdbc:informix-sqli://123.45.67.89:11/mydb::informixserver=ss;\"]},\"spans\":[{\"type\":3,\"kind\":117,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"urlFromDataSource\":1}},{\"type\":3,\"kind\":125,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"urlFromDataSource\":2}},{\"type\":3,\"kind\":116,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"urlFromDataSource\":3}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":4}},{\"type\":3,\"kind\":115,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":5}},{\"type\":3,\"kind\":116,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":3}},{\"type\":3,\"kind\":118,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":6}},{\"type\":3,\"kind\":119,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":7}},{\"type\":3,\"kind\":121,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":8}},{\"type\":3,\"kind\":125,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":9}},{\"type\":3,\"kind\":126,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":10}},{\"type\":3,\"kind\":127,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":11}},{\"type\":3,\"kind\":115,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":12}},{\"type\":3,\"kind\":115,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":13}},{\"type\":3,\"kind\":116,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":14}},{\"type\":3,\"kind\":115,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":15}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":16}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":17}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":18}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":19}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":20}},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":21}},{\"type\":3,\"kind\":116,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":22}},{\"type\":3,\"kind\":121,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":23}},{\"type\":3,\"kind\":121,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":24}},{\"type\":3,\"kind\":121,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":25}},{\"type\":3,\"kind\":9999},{\"type\":3,\"kind\":119,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":26}},{\"type\":3,\"kind\":119,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":27}},{\"type\":3,\"kind\":125,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":28}},{\"type\":3,\"kind\":125,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":29}},{\"type\":3,\"kind\":125,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":30}},{\"type\":3,\"kind\":125,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":31}},{\"type\":3,\"kind\":118,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":32}},{\"type\":3,\"kind\":118,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":33}},{\"type\":3,\"kind\":125,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":34}},{\"type\":3,\"kind\":125,\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":35}}]}}")

var TransDataBytes = []byte("{\"identifier\":\"golang:Go-Tier-Name:zhangnandeMacBook-Pro-2.local:4318:Go-App-Name\",\"tierName\":\"Go-Tier-Name\",\"transactionInfo\":{\"threadId\":32,\"threadName\":\"name\",\"refTraceId\":\"300dd40046d599a8\",\"responseStatus\":200,\"traceId\":\"300dd40046d599a8\",\"tripId\":\"300dd40046d599a8\",\"transactionName\":\"WebTransaction/Go/spans\",\"tierName\":\"Go-Tier-Name\",\"startTimeMs\":1646027992299,\"endTimeMs\":1646027992299,\"startTimeNs\":1646027992299282000,\"endTimeNs\":1646027992299389000,\"dataContext\":{\"errorAttributes\":[{\"key\":\"test\",\"value\":\"test\"}],\"requestParameters\":[{\"key\":\"test\",\"value\":\"test\"}],\"prefixedAgentAttributes\":{\"key\":\"request.parameters.\",\"value\":[{\"key\":\"limit\",\"value\":\"10\"}]},\"errorInfo\":[{\"spanId\":1,\"msg\":\"my error message\",\"exceptionClass\":\"*errors.errorString\",\"stacks\":[\"blueware.(*txn).NoticeError (internal_txn.go:693)\",\"main.noticeError (main.go:55)\",\"http.HandlerFunc.ServeHTTP (server.go:2046)\",\"blueware.WrapHandle.func1 (instrumentation.go:38)\",\"http.HandlerFunc.ServeHTTP (server.go:2046)\",\"blueware.WrapHandleFunc.func1 (instrumentation.go:49)\",\"http.HandlerFunc.ServeHTTP (server.go:2046)\",\"http.(*ServeMux).ServeHTTP (server.go:2424)\",\"http.serverHandler.ServeHTTP (server.go:2878)\",\"http.(*conn).serve (server.go:1929)\",\"runtime.goexit (asm_amd64.s:1581)\"]}],\"hostAndUrls\":[\"host\",\"host:3306/dbname\",\"host:11211\",\"host:xx/dbname\"],\"agentAttributes\":[{\"key\":\"http.server_name\",\"value\":\"bluweware_agent_example_server\"},{\"key\":\"http.method\",\"value\":\"GET\"},{\"key\":\"http.scheme\",\"value\":\"http\"},{\"key\":\"http.route\",\"value\":\"/spans\"},{\"key\":\"http.flavor\",\"value\":\"HTTP/1.1\"},{\"key\":\"net.peer.name\"},{\"key\":\"http.user_agent\",\"value\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36\"},{\"key\":\"http.url\",\"value\":\"http://localhost:8004/spans\"},{\"key\":\"http.client_ip\"},{\"key\":\"http.request_content_length\",\"value\":\"abc\"},{\"key\":\"http.response_content_length\",\"value\":\"0\"},{\"key\":\"http.status_code\"},{\"key\":\"http.request.header.content_type\"},{\"key\":\"http.response.header.content_type\"},{\"key\":\"net.host.port\",\"value\":\"8004\"},{\"key\":\"net.peer.ip\",\"value\":\"[::1]\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"}]},\"isWebTransaction\":true,\"requestUrl\":\"http://localhost:8004/spans\",\"spans\":[{\"spanId\":1,\"startTimeNs\":30000,\"stopTimeNs\":48000,\"type\":3,\"kind\":113,\"startLineNum\":161,\"endLineNum\":168,\"methodName\":\"name\",\"databaseSpanInfo\":{\"sql\":\"INSERT INTO users (name, age) VALUES ($1, $2)\",\"url\":2},\"agentAttributes\":[{\"key\":\"db.sql.table\",\"value\":\"users\"},{\"key\":\"net.peer.name\",\"value\":\"host\"},{\"key\":\"db.name\",\"value\":\"dbname\"},{\"key\":\"code.lineno\",\"value\":\"161\"},{\"key\":\"db.statement\",\"value\":\"INSERT INTO users (name, age) VALUES ($1, $2)\"},{\"key\":\"db.operation\",\"value\":\"insert\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"db.connection_string\",\"value\":\"Server=shopdb.example.com;Database=ShopDb;Uid=billing_user;TableCache=true;UseCompression=True;MinimumPoolSize=10;MaximumPoolSize=50;\"},{\"key\":\"db.user\",\"value\":\"username\"},{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"net.peer.port\",\"value\":\"3306\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":2,\"parentSpanId\":1,\"startTimeNs\":51000,\"stopTimeNs\":72000,\"type\":1,\"kind\":2,\"startLineNum\":198,\"endLineNum\":205,\"methodName\":\"name\",\"mongodbSpanInfo\":{\"host\":1,\"port\":27017,\"operation\":5,\"dborcoll\":\"products\",\"mongodbList\":[{\"keyValueMap\":[{\"key\":\"database\",\"value\":\"dbname\"}]}]},\"agentAttributes\":[{\"key\":\"db.connection_string\",\"value\":\"Server=shopdb.example.com;Database=ShopDb;Uid=billing_user;TableCache=true;UseCompression=True;MinimumPoolSize=10;MaximumPoolSize=50;\"},{\"key\":\"db.user\",\"value\":\"username\"},{\"key\":\"net.peer.port\",\"value\":\"27017\"},{\"key\":\"db.name\",\"value\":\"dbname\"},{\"key\":\"db.mongodb.collection\",\"value\":\"products\"},{\"key\":\"db.statement\",\"value\":\"db.getCollection('products').find()\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"net.peer.name\",\"value\":\"host\"},{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"db.operation\",\"value\":\"find\"},{\"key\":\"code.lineno\",\"value\":\"198\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":3,\"parentSpanId\":2,\"startTimeNs\":1004023000,\"stopTimeNs\":1004139000,\"type\":1,\"kind\":1,\"startLineNum\":234,\"endLineNum\":241,\"methodName\":\"name\",\"redisSpanInfo\":{\"host\":1,\"port\":6379,\"redisOperation\":17},\"agentAttributes\":[{\"key\":\"net.peer.port\",\"value\":\"6379\"},{\"key\":\"db.statement\",\"value\":\"HMSET myhash field1 'Hello' field2 'World\"},{\"key\":\"db.operation\",\"value\":\"HMSET\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"db.connection_string\",\"value\":\"Server=shopdb.example.com;Database=ShopDb;Uid=billing_user;TableCache=true;UseCompression=True;MinimumPoolSize=10;MaximumPoolSize=50;\"},{\"key\":\"net.peer.name\",\"value\":\"host\"},{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"code.lineno\",\"value\":\"234\"},{\"key\":\"db.user\",\"value\":\"username\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":4,\"parentSpanId\":3,\"startTimeNs\":19000,\"stopTimeNs\":32000,\"type\":1,\"kind\":27,\"startLineNum\":270,\"endLineNum\":277,\"methodName\":\"name\",\"influxDBSpanInfo\":{\"host\":1,\"port\":6379,\"sql\":\"select non_negative_derivative(value, 1s)*8 as InSpeed,time from flow\"},\"agentAttributes\":[{\"key\":\"net.peer.name\",\"value\":\"localhost\"},{\"key\":\"net.peer.port\",\"value\":\"6379\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"code.lineno\",\"value\":\"270\"},{\"key\":\"db.connection_string\",\"value\":\"agent@123456127.0.0.1:8086\"},{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"db.name\",\"value\":\"dinfo\"},{\"key\":\"db.statement\",\"value\":\"select non_negative_derivative(value, 1s)*8 as InSpeed,time from flow\"},{\"key\":\"db.operation\",\"value\":\"select\"},{\"key\":\"db.user\",\"value\":\"username\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":5,\"parentSpanId\":4,\"startTimeNs\":19000,\"stopTimeNs\":36000,\"type\":1,\"kind\":3,\"startLineNum\":411,\"endLineNum\":418,\"methodName\":\"name\",\"memcachedSpanInfo\":{\"hostport\":3,\"operation\":3,\"sqlValue\":\"add title 1 0 16\"},\"agentAttributes\":[{\"key\":\"db.user\",\"value\":\"username\"},{\"key\":\"net.peer.name\",\"value\":\"host\"},{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"net.peer.port\",\"value\":\"11211\"},{\"key\":\"db.statement\",\"value\":\"add title 1 0 16\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"code.lineno\",\"value\":\"411\"},{\"key\":\"db.connection_string\",\"value\":\"Server=shopdb.example.com;Database=ShopDb;Uid=billing_user;TableCache=true;UseCompression=True;MinimumPoolSize=10;MaximumPoolSize=50;\"},{\"key\":\"db.operation\",\"value\":\"add\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":6,\"parentSpanId\":5,\"startTimeNs\":23000,\"stopTimeNs\":52000,\"type\":1,\"kind\":4,\"startLineNum\":376,\"endLineNum\":383,\"methodName\":\"name\",\"xmemcachedSpanInfo\":{\"operation\":3,\"host\":1,\"port\":11211,\"sqlValue\":\"add title 1 0 16\"},\"agentAttributes\":[{\"key\":\"db.connection_string\",\"value\":\"Server=shopdb.example.com;Database=ShopDb;Uid=billing_user;TableCache=true;UseCompression=True;MinimumPoolSize=10;MaximumPoolSize=50;\"},{\"key\":\"net.peer.name\",\"value\":\"host\"},{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"net.peer.port\",\"value\":\"11211\"},{\"key\":\"db.operation\",\"value\":\"add\"},{\"key\":\"db.user\",\"value\":\"username\"},{\"key\":\"db.statement\",\"value\":\"add title 1 0 16\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"code.lineno\",\"value\":\"376\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":7,\"parentSpanId\":6,\"startTimeNs\":30000,\"stopTimeNs\":50000,\"type\":1,\"kind\":5,\"startLineNum\":305,\"endLineNum\":312,\"methodName\":\"name\",\"spymemcachedSpanInfo\":{\"host\":1,\"port\":11211,\"sqlInfo\":\"add title 1 0 16\"},\"agentAttributes\":[{\"key\":\"db.connection_string\",\"value\":\"Server=shopdb.example.com;Database=ShopDb;Uid=billing_user;TableCache=true;UseCompression=True;MinimumPoolSize=10;MaximumPoolSize=50;\"},{\"key\":\"db.operation\",\"value\":\"add\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"code.lineno\",\"value\":\"305\"},{\"key\":\"db.user\",\"value\":\"username\"},{\"key\":\"net.peer.name\",\"value\":\"host\"},{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"net.peer.port\",\"value\":\"11211\"},{\"key\":\"db.statement\",\"value\":\"add title 1 0 16\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":8,\"parentSpanId\":7,\"startTimeNs\":22000,\"stopTimeNs\":38000,\"type\":1,\"kind\":6,\"startLineNum\":341,\"endLineNum\":348,\"methodName\":\"name\",\"cassandraSpanInfo\":{\"host\":1,\"port\":7199,\"sql\":\"INSERT INTO user (id,user_name) VALUES (1,'zhangsan');\"},\"agentAttributes\":[{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"db.name\",\"value\":\"myCas\"},{\"key\":\"db.operation\",\"value\":\"insert\"},{\"key\":\"db.user\",\"value\":\"username\"},{\"key\":\"net.peer.name\",\"value\":\"host\"},{\"key\":\"net.peer.port\",\"value\":\"7199\"},{\"key\":\"db.statement\",\"value\":\"INSERT INTO user (id,user_name) VALUES (1,'zhangsan');\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"code.lineno\",\"value\":\"341\"},{\"key\":\"db.connection_string\",\"value\":\"Server=shopdb.example.com;Database=ShopDb;Uid=billing_user;TableCache=true;UseCompression=True;MinimumPoolSize=10;MaximumPoolSize=50;\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":9,\"parentSpanId\":8,\"startTimeNs\":69000,\"stopTimeNs\":116000,\"type\":4,\"kind\":26,\"startLineNum\":448,\"endLineNum\":455,\"methodName\":\"name\",\"mq\":{\"mqType\":3,\"destType\":1,\"destName\":\"myTopic\",\"name\":\"name\"},\"agentAttributes\":[{\"key\":\"net.peer.name\",\"value\":\"hostname\"},{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"code.lineno\",\"value\":\"448\"},{\"key\":\"messaging.destination_type\",\"value\":\"consume\"},{\"key\":\"messaging.destination_kind\",\"value\":\"topic\"},{\"key\":\"messaging.protocol\",\"value\":\"Kafka\"},{\"key\":\"messaging.protocol_version\",\"value\":\"0.9.1\"},{\"key\":\"messaging.destination\",\"value\":\"myTopic\"},{\"key\":\"messaging.message_payload_size_bytes\",\"value\":\"2738\"},{\"key\":\"net.peer.port\",\"value\":\"80\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":10,\"parentSpanId\":9,\"startTimeNs\":37000,\"stopTimeNs\":57000,\"type\":4,\"kind\":26,\"startLineNum\":485,\"endLineNum\":492,\"methodName\":\"name\",\"mq\":{\"mqType\":2,\"destType\":2,\"destName\":\"myTopic\",\"name\":\"name\"},\"agentAttributes\":[{\"key\":\"code.lineno\",\"value\":\"485\"},{\"key\":\"messaging.destination_kind\",\"value\":\"topic\"},{\"key\":\"net.peer.name\",\"value\":\"hostname\"},{\"key\":\"net.peer.ip\",\"value\":\"192.0.2.14\"},{\"key\":\"net.peer.port\",\"value\":\"80\"},{\"key\":\"messaging.message_payload_size_bytes\",\"value\":\"2738\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"messaging.destination_type\",\"value\":\"produce\"},{\"key\":\"messaging.destination\",\"value\":\"myTopic\"},{\"key\":\"messaging.protocol\",\"value\":\"Kafka\"},{\"key\":\"messaging.protocol_version\",\"value\":\"0.9.1\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":11,\"parentSpanId\":10,\"startTimeNs\":35000,\"stopTimeNs\":341363000,\"type\":2,\"kind\":7,\"startLineNum\":553,\"endLineNum\":574,\"methodName\":\"name\",\"external\":{\"url\":\"https://money.163.com/fund\",\"uri\":\"/fund\",\"host\":1,\"port\":\"443\",\"method\":1,\"crossMetricName\":\"name\",\"spanRefTraceid\":\"82682ba3c1afec88\"},\"agentAttributes\":[{\"key\":\"net.peer.port\"},{\"key\":\"net.peer.name\",\"value\":\"money.163.com\"},{\"key\":\"http.scheme\",\"value\":\"https\"},{\"key\":\"http.status_code\",\"value\":\"200\"},{\"key\":\"http.response_content_length\",\"value\":\"252457\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"code.lineno\",\"value\":\"553\"},{\"key\":\"http.method\",\"value\":\"GET\"},{\"key\":\"http.url\",\"value\":\"https://money.163.com:443/fund\"},{\"key\":\"http.flavor\",\"value\":\"HTTP 2.0\"},{\"key\":\"http.request_content_length\",\"value\":\"7\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":12,\"parentSpanId\":11,\"startTimeNs\":80000,\"stopTimeNs\":99000,\"type\":5,\"startLineNum\":107,\"endLineNum\":131,\"methodName\":\"f1\",\"className\":\"class\",\"agentAttributes\":[{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/examples/main.go\"},{\"key\":\"code.lineno\",\"value\":\"107\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"spanId\":13,\"parentSpanId\":12,\"startTimeNs\":449000,\"stopTimeNs\":3296000,\"type\":2,\"kind\":23,\"startLineNum\":43,\"endLineNum\":52,\"methodName\":\"/service.Greeter/SayHello\",\"external\":{\"url\":\"grpc://127.0.0.1:8004\",\"uri\":\"service.Greeter/SayHello\",\"port\":\"8004\",\"crossMetricName\":\"/service.Greeter/SayHello\",\"spanRefTraceid\":\"65d08b0e5e85a497\"},\"agentAttributes\":[{\"key\":\"net.peer.port\",\"value\":\"xx\"},{\"key\":\"http.header.guid\",\"value\":\"65d08b0e5e85a497\"},{\"key\":\"rpc.method\",\"value\":\"SayHello\"},{\"key\":\"code.filepath\",\"value\":\"/Users/zhangnan/code2/go-agent-tencent/blueware/framework/oneapm_grpc/unaryClientInterceptor.go\"},{\"key\":\"net.peer.ip\",\"value\":\"127.0.0.1\"},{\"key\":\"net.transport\",\"value\":\"ip_tcp\"},{\"key\":\"rpc.service\",\"value\":\"service.Greeter\"},{\"key\":\"code.lineno\",\"value\":\"43\"},{\"key\":\"rpc.system\",\"value\":\"grpc\"},{\"key\":\"net.host.ip\",\"value\":\"10.128.6.99\"},{\"key\":\"net.host.port\",\"value\":\"4318\"}]},{\"type\":3,\"kind\":113,\"databaseSpanInfo\":{\"url\":4}}],\"crossProcessId\":\"9#424\"},\"settingHashCode\":{\"agent\":1646027968124016000},\"resource\":{\"dataId\":\"Go-App-Name\",\"dataToken\":\"X0haQQpYHlfd44tDCQkVBANUf425AlNcAAxWDA6ee9oGAUlUDQQH57d7UwFeXAQMXgcF\",\"sdkLanguage\":\"golang\",\"serviceName\":\"Go-Tier-Name\",\"hostName\":\"zhangnandeMacBook-Pro-2.local\",\"hostIp\":\"10.128.6.99\",\"hostPort\":\"8004\"}}")

func init() {
	_ = json.Unmarshal(TransDataBytes, &TransDataTest)
	TransDataBytesPb, _ = proto.Marshal(&TransDataTest)

	_ = json.Unmarshal(transDataTestMetricNameByte, &transDataTestMetricName)
	_ = json.Unmarshal(TransDataJavaByte, &TransDataJava)
	_ = json.Unmarshal(transDataTestMetricNameJavaByte, &transDataTestMetricNameJava)
}
